#!/usr/bin/env python
"""
转换项目为可安装的包结构
运行此脚本后，可以使用 pip install -e . 安装项目
"""

import os

def create_package_structure():
    """创建包结构"""
    print("开始创建包结构...")
    
    # 当前目录
    curr_dir = os.path.dirname(os.path.abspath(__file__))
    parent_dir = os.path.dirname(curr_dir)
    
    # 创建setup.py
    setup_path = os.path.join(parent_dir, "setup.py")
    with open(setup_path, "w", encoding="utf-8") as f:
        f.write("""
from setuptools import setup, find_packages

setup(
    name="WebSearchResearchAgent",
    version="0.1.0",
    packages=find_packages(),
    install_requires=[
        "pocketflow>=0.1.0",
        "zhipuai>=0.1.0",
        "requests>=2.28.0",
        "beautifulsoup4>=4.11.0",
        "pydantic>=1.9.0",
        "PyYAML>=6.0",
        "openai>=1.0.0",
    ],
    entry_points={
        'console_scripts': [
            'websearch-agent=WebSearchResearchAgent.run:main',
        ],
    },
)
""")
    
    print(f"已创建 setup.py: {setup_path}")
    print("\n现在可以使用以下命令安装包:")
    print("pip install -e .")
    print("\n安装后可以使用以下命令运行:")
    print("websearch-agent -q \"你的问题\" -d")

if __name__ == "__main__":
    create_package_structure() 